<template>
  <span role="img" :aria-label="type" :class="[ 'anticon pro-icon', { 'has-beat': beat }]">
    <svg :data-icon="type" width="1em" height="1em" fill="currentColor" aria-hidden="true" focusable="false">
      <use :xlink:href="`#pro-icon-${ type }`" />
    </svg>
  </span>
</template>

<script>
export default {
  name: 'ProIcon',
  props: {
    type: {
      type: String,
      required: true
    },
    beat: Boolean
  }
}
</script>

<style>
.pro-icon.has-beat:active {
  animation: pro-icon-beat .5s 1 forwards;
}
@keyframes pro-icon-beat {
  30% { transform: scale(1.1); }
  50% { transform: scale(.9); }
  100% { transform: scale(1); }
}
</style>
